package hongcaosp.app.android.user.settings.safety.update;

import android.content.Intent;
import android.view.View;

import hongcaosp.app.android.R;
import xlj.lib.android.base.component.BaseActivity;
import xlj.lib.android.base.utils.StatusBarUtil;

public class UpdatePasswordActivity extends BaseActivity {

    private UpdateByPasswordFragment updateByPasswordFragment;
    private UpdateByCodeFragment updateByCodeFragment;
    private UpdatePasswordFragment updatePasswordFragment;

    @Override
    protected void initData(Intent intent) {

    }

    @Override
    protected void initView() {
        StatusBarUtil.setStatusBarDarkTheme(this,false);
        findViewById(R.id.back_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        updateByPasswordFragment();
    }

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_update_password;
    }

    /**
     * 根据当前密码验证
     */
    public void updateByPasswordFragment() {
        if (updateByPasswordFragment == null) {
            updateByPasswordFragment = new UpdateByPasswordFragment();
        }
        getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.fl_container,updateByPasswordFragment)
                .commit();
    }

    /**
     * 根据验证码验证
     */
    public void updateByCodeFragment() {
        if (updateByCodeFragment == null) {
            updateByCodeFragment = new UpdateByCodeFragment();
        }
        getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.fl_container,updateByCodeFragment)
                .commit();
    }

    /**
     * 修改密码
     */
    public void updatePasswordFragment() {
        if (updatePasswordFragment == null) {
            updatePasswordFragment = new UpdatePasswordFragment();
        }
        getSupportFragmentManager()
                .beginTransaction()
                .add(R.id.fl_container,updatePasswordFragment)
                .commit();
    }
}
